package com.example.rocketmqspringbootdemo.service.consumer;

import com.example.rocketmqspringbootdemo.CommonConstrant;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Service
@RocketMQMessageListener(topic = CommonConstrant.RocketMQ.STRING_TOPIC_ORDERLY,
        consumerGroup =  CommonConstrant.RocketMQ.STRING_CONSUMER_ORDERLY_GROUP,
        messageModel = MessageModel.CLUSTERING,
        consumeMode = ConsumeMode.ORDERLY)
public class StringTopicOrderlyConsumer implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {
        System.out.println("[STRING_TOPIC_ORDERLY]received: " + message);
    }
}
